#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <string>
using namespace std;

class Solution {
public:
    bool CheckPermutation(string s1, string s2) {
        sort(s1.begin(), s1.end());
        sort(s2.begin(), s2.end());
        return s1 == s2;
    }
};

class Solution {
public:
    bool CheckPermutation(string s1, string s2) {
        int hash[26] = { 0 };
        for (auto e : s1)
            hash[e - 'a']++;
        for (auto e : s2)
            hash[e - 'a']--;
        for (auto e : hash)
            if (e) return false;
        return true;
    }
};